---
title: "Reference: Agent.getDefaultGenerateOptionsLegacy() | Agents"
description: "Documentation for the `Agent.getDefaultGenerateOptionsLegacy()` method in Mastra agents, which retrieves the default options used for generateLegacy calls."
---

# Agent.getDefaultGenerateOptionsLegacy()

:::warning

**Deprecated**: This method is deprecated and only works with V1 models. For V2 models, use the new [`.getDefaultOptions()`](./getDefaultOptions) method instead.

:::

Agents can be configured with default generation options for controlling model behavior, output formatting and tool and workflow calls. The `.getDefaultGenerateOptionsLegacy()` method retrieves these defaults, resolving them if they are functions. These options apply to all `generateLegacy()` calls unless overridden and are useful for inspecting an agent’s unknown defaults.

## Usage example

```typescript copy
await agent.getDefaultGenerateOptionsLegacy();
```

## Parameters

<PropertiesTable
  content={[
    {
      name: "options",
      type: "{ requestContext?: RequestContext }",
      isOptional: true,
      defaultValue: "{}",
      description: "Optional configuration object containing request context.",
    },
  ]}
/>

## Returns

<PropertiesTable
  content={[
    {
      name: "defaultOptions",
      type: "AgentGenerateOptions | Promise<AgentGenerateOptions>",
      description:
        "The default generation options configured for the agent, either as a direct object or a promise that resolves to the options.",
    },
  ]}
/>

## Extended usage example

```typescript copy
await agent.getDefaultGenerateOptionsLegacy({
  requestContext: new RequestContext(),
});
```

### Options parameters

<PropertiesTable
  content={[
    {
      name: "requestContext",
      type: "RequestContext",
      isOptional: true,
      defaultValue: "new RequestContext()",
      description:
        "Request Context for dependency injection and contextual information.",
    },
  ]}
/>

## Related

- [Agent generation](/docs/v1/agents/overview#generating-responses)
- [Request Context](/docs/v1/server-db/request-context)
